<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="contents_post">
    <c:if test="${currentPost == null || currentPost.postID == '-1'}">
        <h2>New Post</h2>
    </c:if>
    <c:if test="${currentPost != null && currentPost.postID != '-1'}">
        <h2>Edit Post</h2>
    </c:if>
    <div class="new_post">
        <form name="form" action="/JudiBlog/memberpost" method="Post" enctype="multipart/form-data">
            <input type="text" name="post_id" class="post_id" value="${currentPost.postID}"/>
            <input type="text" name="edit_by" class="edit_by" value="${editBy}"/>
            <label class="mes_box">${msgResult}</label>
            <div id="post_title">
                <label>Title</label>
                <input type="text" name="postTitle" placeholder="Post title" class="post_title" value="${currentPost.title}"/>
                <input type="submit" name="action" value="${currentPost != null && currentPost.postID != '-1'  ? 'Update':'Publish'}"  class="input_submit"/>
                <input type="reset" name="action" value="Reset" class="input_submit"/>
                <button type="button" class="input_submit">Close</button>
            </div>
            <div id="post_content">
                <textarea name="postContent">${currentPost.pathContent}</textarea>
            </div>
            <div id="post_setting">
                <label class="lablel">Lablel</label>
                <select name="categoryName">
                    <option value="JAVA" ${currentPost.getCategory().catName =='JAVA' ? 'selected':''}/>Java</option>
                    <option value=".NET" ${currentPost.getCategory().catName =='.NET' ? 'selected':''} />.Net</option>
                    <option value="PHP" ${currentPost.getCategory().catName =='PHP' ? 'selected':''} />PHP</option>
                    <option value="XML" ${currentPost.getCategory().catName =='XML' ? 'selected':''}/>XML</option>
                    <option value="HTML" ${currentPost.getCategory().catName =='HTML' ? 'selected':''}/>HTML</option>
                    <option value="Other" ${currentPost.getCategory().catName =='Other' ? 'selected':''} />Other</option>
                </select>
            </div>
            <div id="post_image">
                <label class="lablel">Post image</label>
                <c:if test="${currentPost != null}">
                    <img id="image_post" class="post_image" alt="Post image" src="/JudiBlog/img/post/${currentPost.pathImage}"/>
                </c:if>
                <c:if test="${currentPost == null}">
                    <img id="image_post" class="post_image" alt="Post image" src="/JudiBlog/img/post/default.png"/>
                </c:if>
                <input type="file" name="file" class="browers"  accept="image/*" onchange="previewImage();"/>
            </div>
        </form>
    </div>
</div>